﻿using GameServer.Battle;
using GameServer.Model;
using Serilog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GameServer.Mgr
{
    public class SkillManager
    {
        private Character owner;
        public List<Skill> skills = new List<Skill>();
        public SkillManager(Character owner) 
        {
            this.owner = owner;
            this.InitSkills();
        }

        public void InitSkills()
        {
            //ToDo这里后面要加入数据库的信息存储，这里的Json表格数据现在有点问题后面要修改
            //初始化技能信息(这里后面)
            var list=DataManager.Instance.CharacterSkillDict.Values
                .Where(s => s.TID == owner.jobId).ToList();
            foreach (var define in list)
            {
                var skill = new Skill(owner,define.ID)
                {

                };
                skills.Add(skill);
                Log.Information("角色{0}加载技能[{1}-{2}]", owner.Name, skill.Define.ID, skill.Define.Name);
            }
        }
        public void Update()
        {
            foreach (Skill skill in skills)
            {
                skill.Update();
            }
        }
    }
}
